package com.xiao.train.business.controller.admin;

import com.xiao.train.business.service.SkTokenService;
import com.xiao.train.common.resp.CommonResp;
import com.xiao.train.business.req.SkTokenQueryReq;
import com.xiao.train.business.req.SkTokenSaveReq;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("admin/sk-token")
public class SkTokenAdminController {

    @Autowired
    SkTokenService skTokenService;

    @PostMapping("save")
    public CommonResp save(@Valid @RequestBody SkTokenSaveReq req) {
        skTokenService.save(req);
        return new CommonResp();
    }

    @GetMapping("query-list")
    public CommonResp queryList(@Valid SkTokenQueryReq req) {
        return new CommonResp(skTokenService.queryList(req));
    }

    @DeleteMapping("delete/{id}")
    public CommonResp delete(@PathVariable Long id) {
        skTokenService.delete(id);
        return new CommonResp();
    }
}